#!/bin/bash
set -ex

export MTSQL_PT_MASTER=zf-dba-mysql-mtsqlci05
#export MTSQL_PT_SLAVE1=zf-dba-mysql-mtsqlci04
#export MTSQL_PT_SLAVE2=zf-dba-mysql-mtsqlci05
#export MTSQL_PT_USER=sankuai
#export MTSQL_PT_ROOT_PASSWORD=test
export MTSQL_PT_PORT=5002
export MTSQL_PT_SYSBENCH_USER=sbtest
export MTSQL_PT_PASSWORD=sbtest
export MTSQL_PT_STORAGE_ENGINE=innodb
export MTSQL_PT_TABLES=32
export MTSQL_PT_TABLE_SIZE=12000000
export MTSQL_PT_PERCENTILE=99.9
export MTSQL_PT_HISTOGRAM=on
export MTSQL_PT_REPORT_INTERVAL=1
export MTSQL_PT_WARMUP_TIME=10
export MTSQL_PT_MYSQL_IGNORE_ERRORS=all
export MTSQL_PT_RATE=0
export MTSQL_PT_SKIP_TRX=off
export MTSQL_PT_TIME=300
export MTSQL_PT_TEST_INTERVAL_TIME=30
export MTSQL_PT_DB_PS_MODE=disable

#dynamic param
export MTSQL_PT_DB=sbtest
export MTSQL_PT_TEST_CASE=

#user define vars
if [ -n "${MTSQL_PT_MASTER_SPEC}" ]; then
  MTSQL_PT_MASTER=${MTSQL_PT_MASTER_SPEC}
fi

if [ -n "${MTSQL_PT_PORT_SPEC}" ]; then
  MTSQL_PT_PORT=${MTSQL_PT_PORT_SPEC}
fi

if [ -n "${MTSQL_PT_SYSBENCH_USER_SPEC}" ]; then
  MTSQL_PT_SYSBENCH_USER=${MTSQL_PT_SYSBENCH_USER_SPEC}
fi

if [ -n "${MTSQL_PT_PASSWORD_SPEC}" ]; then
  MTSQL_PT_PASSWORD=${MTSQL_PT_PASSWORD_SPEC}
fi

if [ -n "${MTSQL_PT_DB_SPEC}" ]; then
  MTSQL_PT_DB=${MTSQL_PT_DB_SPEC}
fi

if [ -n "${MTSQL_PT_STORAGE_ENGINE_SPEC}" ]; then
  MTSQL_PT_STORAGE_ENGINE=${MTSQL_PT_STORAGE_ENGINE_SPEC}
fi

if [ -n "${MTSQL_PT_TABLES_SPEC}" ]; then
  MTSQL_PT_TABLES=${MTSQL_PT_TABLES_SPEC}
fi

if [ -n "${MTSQL_PT_TABLE_SIZE_SPEC}" ]; then
  MTSQL_PT_TABLE_SIZE=${MTSQL_PT_TABLE_SIZE_SPEC}
fi

if [ -n "${MTSQL_PT_PERCENTILE_SPEC}" ]; then
  MTSQL_PT_PERCENTILE=${MTSQL_PT_PERCENTILE_SPEC}
fi

if [ -n "${MTSQL_PT_HISTOGRAM_SPEC}" ]; then
  MTSQL_PT_HISTOGRAM=${MTSQL_PT_HISTOGRAM_SPEC}
fi

if [ -n "${MTSQL_PT_REPORT_INTERVAL_SPEC}" ]; then
  MTSQL_PT_REPORT_INTERVAL=${MTSQL_PT_REPORT_INTERVAL_SPEC}
fi

if [ -n "${MTSQL_PT_WARMUP_TIME_SPEC}" ]; then
  MTSQL_PT_WARMUP_TIME=${MTSQL_PT_WARMUP_TIME_SPEC}
fi

if [ -n "${MTSQL_PT_MYSQL_IGNORE_ERRORS_SPEC}" ]; then
  MTSQL_PT_MYSQL_IGNORE_ERRORS=${MTSQL_PT_MYSQL_IGNORE_ERRORS_SPEC}
fi

if [ -n "${MTSQL_PT_RATE_SPEC}" ]; then
  MTSQL_PT_RATE=${MTSQL_PT_RATE_SPEC}
fi

if [ -n "${MTSQL_PT_SKIP_TRX_SPEC}" ]; then
  MTSQL_PT_SKIP_TRX=${MTSQL_PT_SKIP_TRX_SPEC}
fi

if [ -n "${MTSQL_PT_TIME_SPEC}" ]; then
  MTSQL_PT_TIME=${MTSQL_PT_TIME_SPEC}
fi

if [ -n "${MTSQL_PT_TEST_INTERVAL_TIME_SPEC}" ]; then
  MTSQL_PT_TEST_INTERVAL_TIME=${MTSQL_PT_TEST_INTERVAL_TIME_SPEC}
fi

if [ -n "${MTSQL_PT_DB_PS_MODE_SPEC}" ]; then
  MTSQL_PT_DB_PS_MODE=${MTSQL_PT_DB_PS_MODE_SPEC}
fi

